//# sourceURL=http://uMapApp/UI/Panel/BottomPanel
define([
    "mhjs/mhjs",
    "./Panel",
    "../Search",
    "../TopMenu/TopMenu"
], function (
    mhjs,
    Panel,
    Search,
    TopMenu
) {

    function BottomPanel(option) {

        var _this = this;

        _this.ui = {
            copyright   : new mhjs.Div({"class": "copyright"}),
            positionInfo: new mhjs.Div({"class": "positionInfo"})
        };

        _this.ui.positionInfo.longitudeInfo = new mhjs.Div({"class": "longitudeInfo item"});
        _this.ui.positionInfo.longitudeInfo.label = new mhjs.Div({"class": "label"});
        _this.ui.positionInfo.longitudeInfo.label.text("经度");
        _this.ui.positionInfo.longitudeInfo.valueText = new mhjs.Div({"class": "valueText"});
        _this.ui.positionInfo.longitudeInfo
            .append(_this.ui.positionInfo.longitudeInfo.label)
            .append(_this.ui.positionInfo.longitudeInfo.valueText);

        _this.ui.positionInfo.latitudeInfo = new mhjs.Div({"class": "latitudeInfo item"});
        _this.ui.positionInfo.latitudeInfo.label = new mhjs.Div({"class": "label"});
        _this.ui.positionInfo.latitudeInfo.label.text("纬度");
        _this.ui.positionInfo.latitudeInfo.valueText = new mhjs.Div({"class": "valueText"});
        _this.ui.positionInfo.latitudeInfo
            .append(_this.ui.positionInfo.latitudeInfo.label)
            .append(_this.ui.positionInfo.latitudeInfo.valueText);

        _this.ui.positionInfo.heightInfo = new mhjs.Div({"class": "heightInfo item"});
        _this.ui.positionInfo.heightInfo.label = new mhjs.Div({"class": "label"});
        _this.ui.positionInfo.heightInfo.label.text("高度");
        _this.ui.positionInfo.heightInfo.valueText = new mhjs.Div({"class": "valueText"});
        _this.ui.positionInfo.heightInfo
            .append(_this.ui.positionInfo.heightInfo.label)
            .append(_this.ui.positionInfo.heightInfo.valueText);

        _this.ui.positionInfo
            .append(_this.ui.positionInfo.longitudeInfo)
            .append(_this.ui.positionInfo.latitudeInfo)
            .append(_this.ui.positionInfo.heightInfo);

        Panel.call(_this, option);
        _this.addClass("bottomPanel");

        _this
            .append(_this.ui.copyright)
            .append(_this.ui.positionInfo);

    }

    var _class = BottomPanel;
    mhjs.Inherit(_class, Panel);

    Object.defineProperties(_class, {
        "distanceText": {
            value: function (distance) {
                return (distance > 1000 ? ((distance / 1000).toFixed(2) + " KM") : (distance.toFixed(2) + " M"));
            }
        }
    });

    Object.defineProperties(_class.prototype, {
        "copyright": {
            set: function (copyright) {
                var _this = this;
                _this._copyright = copyright;
                _this.ui.copyright.text(copyright);
            },
            get: function () {
                return this._copyright;
            }
        },
        "position" : {
            set: function (position) {
                var _this = this;
                _this._position = position;

                _this.ui.positionInfo.longitudeInfo.valueText.text(position.lnglat.longitude.toFixed(4));
                _this.ui.positionInfo.latitudeInfo.valueText.text(position.lnglat.latitude.toFixed(4));
                _this.ui.positionInfo.heightInfo.valueText.text(_class.distanceText(position.lnglat.height));
            },
            get: function () {
                return this._position;
            }
        }
    });

    return _class;

});